package com.it.bigdata.schedual.imp;

import com.it.bigdata.schedual.Schedual;

import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedDeque;

public class BDTBSchedualForQueue implements Schedual {
    //定义页码，每页有50条
    private long CurrentPageNum=0L;

    //私有化构造方法，使用单例模式
    private BDTBSchedualForQueue(){}
    private static final BDTBSchedualForQueue bdtsq=new BDTBSchedualForQueue();
    //提供获取对象的方法
    public static BDTBSchedualForQueue getBdtsq(){
        return bdtsq;
    }
    //使用一个高并发的队列调度器用来存储url列表，让调度器来电镀
    public static Queue<String> queue= new ConcurrentLinkedDeque();

    public void push(String url) {
        queue.offer(url);
    }

    public String pop() {
        return queue.poll();
    }

    public long getCurrentPageNum() {
        return CurrentPageNum;
    }

    public void nextPage(){
        CurrentPageNum+=50;
    }

}
